# catalog.py
# Author: Peter Sovietov

bwv_file = 'bwv.txt'
kv_file = 'kv.txt'
chopin_file = 'chopin.txt'

def bwv(code):
    f = open(bwv_file, 'r')
    code = 'BWV' + str(code).lower()
    answer = f.readline()
    for line in f:
        if line.startswith(code):
            answer = line.rstrip()
            break
    f.close()
    return answer

def kv(code):
    f = open(kv_file, 'r')
    code = 'K.' + str(code).lower()
    answer = f.readline()
    for line in f:
        if line.startswith(code):
            answer = line.rstrip()
            break
    f.close()
    return answer

def chopin(code):
    f = open(chopin_file, 'r')
    code = str(code)
    answer = f.readline()
    for line in f:
        if line.startswith(code):
            answer = line.rstrip()
            break
    f.close()
    return answer

